package co.com.mobilecitas;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

/**
 * @author fredyalexis
 * 
 */
public class PrincipalActivity extends Activity {

	public final static String EXTRA_MESSAGE = "co.com.mobilecitas.MESSAGE";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_principal);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.principal, menu);
		return true;
	}

	public void sendMessage(View view) {
		//Se realiza nuevo llamado a otra actividad
		Intent intent = new Intent(this, DisplayMessageActivity.class);
		EditText editText = (EditText) findViewById(R.id.edit_message);
		String message;
        message = editText.getText().toString();
        if(message!=null){
            intent.putExtra(EXTRA_MESSAGE, message);
        }
		startActivity(intent);
	}

}
